/**
 * 
 */
package com.freecsim.markdown.sql;

import java.util.List;

import com.freecsim.markdown.SpecificationModel;

/**
 * @author Administrator
 *
 */
public class DatabaseMarkdownModel extends SpecificationModel{
	
	private String databaseName;
	
	private List<DocTable> tables;
	
	public DatabaseMarkdownModel(String databaseName) {
		super();
		this.databaseName = databaseName;
	}
	
	/**
	 * @return the tables
	 */
	public List<DocTable> getTables() {
		return tables;
	}

	/**
	 * @param tables the tables to set
	 */
	public void setTables(List<DocTable> tables) {
		this.tables = tables;
	}



	public DatabaseMarkdownModel() {
		super();
	}

	/**
	 * @return the databaseName
	 */
	public String getDatabaseName() {
		return databaseName;
	}

	/**
	 * @param databaseName the databaseName to set
	 */
	public void setDatabaseName(String databaseName) {
		this.databaseName = databaseName;
	}


	public String toMarkdownString() {
		StringBuilder sb = new StringBuilder();
		sb.append("## 数据库名称:")
		  .append(getDatabaseName())
		  .append("\n")
		  .append("## Table Definition(数据表定义)")
		  .append("\n");
		if(tables != null){
			for(DocTable table : tables){
		    	 sb.append(table.toMarkdownString());
		    }
		}
		return sb.toString();
	}
}
